package com.ice.remoting;

/**
 * @author wangwei
 * @Date 2024/1/3 10:39
 */

public abstract class NettyServerConfig {

    private String bindAddress = "0.0.0.0";
    /**
     * 监听端口
     */
    private int serverWorkerThreads = 8;
    /**
     * 服务器回调处理线程
     */
    private int serverCallbackExecutorThreads = 0;
    /**
     * 服务器选择线程数
     */
    private int serverSelectorThreads = 3;
    /**
     * idle 超时时间
     */
    private int serverChannelMaxIdleTimeSeconds = 120;

    private boolean useEpollNativeSelector = false;
    /**
     * 设备存活扫描间隔
     */

    private long scanNotActiveBrokerInterval = 5 * 1000;
    /**
     * 请求超时时间
     */
    private long requestTimeoutMillis = 15000;
    /**
     * 是否开启接受类型
     */
    private boolean receiveType = false;
    /**
     * 是否开启扫码设备存活
     */
    private boolean scanBrokerFlag = false;

    /**
     * 处理客户端请求的线程数
     */
    private int clientRequestThreadPoolNums = 8;

    /**
     * 最大客户端请求数.
     */
    private int clientRequestThreadPoolQueueCapacity = 50000;
    /**
     * channel 存活时间
     */
    private int channelExpireTime = 45 * 1000;

    public abstract Integer getListenPort();

    public String getBindAddress() {
        return bindAddress;
    }

    public void setBindAddress(String bindAddress) {
        this.bindAddress = bindAddress;
    }

    public int getServerWorkerThreads() {
        return serverWorkerThreads;
    }

    public void setServerWorkerThreads(int serverWorkerThreads) {
        this.serverWorkerThreads = serverWorkerThreads;
    }

    public int getServerCallbackExecutorThreads() {
        return serverCallbackExecutorThreads;
    }

    public void setServerCallbackExecutorThreads(int serverCallbackExecutorThreads) {
        this.serverCallbackExecutorThreads = serverCallbackExecutorThreads;
    }

    public int getServerSelectorThreads() {
        return serverSelectorThreads;
    }

    public void setServerSelectorThreads(int serverSelectorThreads) {
        this.serverSelectorThreads = serverSelectorThreads;
    }

    public int getServerChannelMaxIdleTimeSeconds() {
        return serverChannelMaxIdleTimeSeconds;
    }

    public void setServerChannelMaxIdleTimeSeconds(int serverChannelMaxIdleTimeSeconds) {
        this.serverChannelMaxIdleTimeSeconds = serverChannelMaxIdleTimeSeconds;
    }

    public boolean isUseEpollNativeSelector() {
        return useEpollNativeSelector;
    }

    public void setUseEpollNativeSelector(boolean useEpollNativeSelector) {
        this.useEpollNativeSelector = useEpollNativeSelector;
    }

    public long getScanNotActiveBrokerInterval() {
        return scanNotActiveBrokerInterval;
    }

    public void setScanNotActiveBrokerInterval(long scanNotActiveBrokerInterval) {
        this.scanNotActiveBrokerInterval = scanNotActiveBrokerInterval;
    }

    public long getRequestTimeoutMillis() {
        return requestTimeoutMillis;
    }

    public void setRequestTimeoutMillis(long requestTimeoutMillis) {
        this.requestTimeoutMillis = requestTimeoutMillis;
    }

    public boolean isReceiveType() {
        return receiveType;
    }

    public void setReceiveType(boolean receiveType) {
        this.receiveType = receiveType;
    }

    public boolean isScanBrokerFlag() {
        return scanBrokerFlag;
    }

    public void setScanBrokerFlag(boolean scanBrokerFlag) {
        this.scanBrokerFlag = scanBrokerFlag;
    }

    public int getClientRequestThreadPoolNums() {
        return clientRequestThreadPoolNums;
    }

    public void setClientRequestThreadPoolNums(int clientRequestThreadPoolNums) {
        this.clientRequestThreadPoolNums = clientRequestThreadPoolNums;
    }

    public int getClientRequestThreadPoolQueueCapacity() {
        return clientRequestThreadPoolQueueCapacity;
    }

    public void setClientRequestThreadPoolQueueCapacity(int clientRequestThreadPoolQueueCapacity) {
        this.clientRequestThreadPoolQueueCapacity = clientRequestThreadPoolQueueCapacity;
    }

    public int getChannelExpireTime() {
        return channelExpireTime;
    }

    public void setChannelExpireTime(int channelExpireTime) {
        this.channelExpireTime = channelExpireTime;
    }
}
